package com.pan.download5.factory.builder;

import com.pan.download5.config.entity.LineInfo;

import java.util.Map;

public abstract class AbstractPageDirectoryFactory {


    public abstract FactoryEntity createFactory(LineInfo lineInfo);

    protected String getMapValue(Map<String,String> infoMap, String targetName){
        if (!infoMap.containsKey(targetName) ) {
            String mapStr = infoMap.entrySet().stream().map(kv -> kv.getKey() + "=" + kv.getValue()).reduce((pre, nxt) -> pre + ", " + nxt).get();
            throw new RuntimeException("AbstractFactory create Error: not found "+targetName+". infoMap{"+mapStr+"}");
        }
        return infoMap.get(targetName);

    }

}
